﻿using OD.ProjectCustomizationTool.Helpers;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OD.ProjectCustomizationTool.Tools
{
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "CLS")]
    internal sealed class CLSCompliantSetter : SingleLineFileUpdaterBase
    {
        protected override string FileRelativePath
        {
            get { return Properties.Resources.AssemblyInfoRelativePath; }
        }

        protected override string SearchPattern
        {
            get { return Properties.Resources.CLSCompliantAssemblyInfoMarkSearchPattern; }
        }

        protected override string ReplaceLineWith
        {
            get
            {
                return Properties.Resources.CLSCompliantAssemblyInfoMark;
            }
        }

        protected override string CommentToAddBeforeReplacePattern
        {
            get
            {
                return Properties.Resources.CLSCompliantAssemblyInfoMarkComment;
            }
        }

        /// <summary>
        /// Sometimes, the CLS compliant attribute needs to be overriden so we do not want to update that information.
        /// </summary>
        protected override bool IsAllowedUpdatingLine
        {
            get
            {   
                return false;
            }
        }

        protected override void InternalUpdate()
        {
            if (!this.ProjectTypes.Contains(EProjectType.Modeling))
            {
                base.InternalUpdate();
            }
            //else
            //{   // Modeling projects do not contain AssemblyInfo file.
            //}
        }

    }
}
